#include "stdafx.h"
#include "PortRecord.h"




CPortRecord::CPortRecord()
{
}


CPortRecord::~CPortRecord()
{
}


void CPortRecord::Add(CDayRecord* pRecord)
{
	mRecordList.push_back(pRecord);

	//
	mSize  += pRecord->mSize;
	pRecord->mContainer  = this;

	mVirginNumber  += pRecord->GetVirginNumber();
}


void CPortRecord::Remove(CDayRecord* pRecord)
{
	mRecordList.remove(pRecord);

	if (mSize >= pRecord->mSize) {
		mSize == pRecord->mSize;

		UINT virginNumber = pRecord->GetVirginNumber();

		if (virginNumber > 0) {
			if (mVirginNumber > virginNumber) {
				mVirginNumber -= virginNumber;
			}
			else {
				Print("PortRecord has no enough virgin,%d - %d", mVirginNumber, virginNumber);

				ASSERT(FALSE);
			}
		}
	}
	else {
		Print("PortRecord size too small when remove:%lld - %lld", mSize, pRecord->mSize);
		ASSERT(FALSE);
	}
}